FLOWCHART BLOCKS

Flowchart Blocks

Visual Designer includes a small set of flowchart blocks which are used as the programming constructs in your firmware. These will be familiar to many users and are listed below in full.

ICON DESCRIPTION ICON DECRIPTION

Event Start Block: Used together with an end block to define a sub-routine or event handler.

Time Delay: A time delay in program execution.

End Block: Used together with an event start block to define a sub-routine or event handler.

Decision Block: A boolean decision in the flowchart.

Assignment Block: Used to assign a value to a variable.

Loop Construct: Used to simplify the configuration of different types of loop.

Subroutine Call: Used to call a sub-routine.

Interconnector : Used in pairs to connect longer sequences of blocks into separate columns on the editor.

Stored Data Block: Used to specify an action on a storage object (such as an SD Card).

Comment : Allows you to add a textual comment on the flowchart.

I/O (Peripheral) Operation: Used to specify an action on the hardware, either internally to the CPU (e.g. timer) or external (e.g. LCD).

 

 

Commenting Blocks

You can add a dedicated tooltip comment to any block via the Edit Notes command on the context menu for the block

Adding a tooltip comment to a block.

Blocks with a comment will be denoted with a little blue triangle at the top right and the comment will be displayed on mouse hover.

Tooltip on mouse over where a comment is defined.

If you need a comment which is always visible then you can add text to the chart itself using the comment block.

Event / Subroutine Block

The event block is used together with the end block to define the start and end of sub-routines (e.g. to write to a display) and event handlers (e.g. to handle a timer interrupt).

If you are creating a subroutine then all that is required is a name for the block. This is the name of  the routine and will be selectable when placing and editing subroutine call blocks.

Simple Subroutine Config - Only the name is required.

If you are creating a routine to handle a triggerable event such as an interrupt handler then you need to also specify the trigger

Setting up a timer interrupt service routine based on a timer1 match event.

The periodic trigger provides a very handy way to get a repeatable call at regular time intervals. It does however make use of one of the CPU timers so be careful not to use it elsewhere if you configure it here for use here.

End Block

The end block is used to terminate a routine or event handler and is normally placed together the event block.

A typical Arduino project will initialize with two event and end blocks, one for program setup and the other for main program execution.

Assignment Block

This is the standard block for assigning values to variables. It is also the place to create new, edit and delete variables.

Assigning values to variables for the time.

Subroutine Call Block

The subroutine block lets you call a function defined elsewhere on the flowchart.

Specifying the subroutine to call.

You must first create and name the subroutine with an event and end block. The combo-box on the subroutine dialogue lists all named routines.

Stored Data Block

The storage block is used to denote an action or method on a storage object (SD Card). The methods are then typically used with resources (e.g a text file) to manipulate the filestore.

When you add a shield that contains an SD card it will almost always have a method for using the contents of the SD Card. For example, a TFT shield has a DrawBitmap() method and a Wave shield has a Play() method. In these cases, you should not use the storage data blocks but rather just drag and drop the resource onto the chart

See Also:

Resources and the Filestore

Tutorial 3: SD Card and TFT Display.

Peripheral Operation Block

A peripheral operation block basically allows you to perform an action on the hardware. With a new project the hardware will consist of only the processor and the available actions are therefore limited.

Available actions on the processor.

However, as you add peripheral shields to your project you will be able to interact and control their I/O via this block type.

Available methods on the Grove Servo Motor Shield.

Time Delay Block

This block is used to introduce a specific delay in the program.

Specifying a 100ms Delay in the program.

In Arduino, no other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. Interrupts and other specific functions will however still work. Refer to the Arduino documentation on Delay() for more detail.

Decision Block

The decision block is the basic yes/no question that determines desired program flow. The dialogue form is fairly self-explanatory and requires a boolean expression.

Testing the is_attached variable in a decision block.

When a decision block is linked on the flowchart, the YES and NO labels are placed in default locations. You can swap them over via the context menu if that better suits the flowchart.

Swap the YES and NO flowlines on a decision block.

Loop Construct Block

The loop construct provides a simple, dialogue driven way to configure some common types of program loop. It is placed as a pair and the required logic blocks are then attached inside the loop.

The edit loop dialogue then provides several options:

Count Loop

The count loop is simply a way of executing the loop body a specified number of times.

Count Loop

For-Next Loop

A For-Next Loop is an extension of the count loop as you need to specify the start, stop and step to determine how often the loop body will execute.

For-Next Loop.

While-Wend Loop

This construct executes the body of the loop while the tested condition evaluates as TRUE.

While-Wend Loop

Note that the test takes place at the top of the loop and so if the test is FALSE to begin with the loop contents will not be executed at all

Repeat-Until Loop

Repeat-Until is very similar to While-Wend except:

  • It executes until the tested condition evaluates to FALSE
  • The test takes place at the bottom of the loop and so the loop body always executes at least once.

Repeat-Until Loop

Interconnector Block

The interconnect blocks are basically 'virtual connections' and need to be in pairs. If you have two interconnect blocks with the same number then you can imagine an invisible wire joining them together. The purpose of the interconnect blocks is to let you split flowchart logic into multiple columns.

You can either drag and drop two interconnect blocks, link them on the flowchart and then re-number appropriately, or you can simply right click and split a flowline.

 

Splitting into two separate lines with interconnect

 

You can join two interconnects together into a single line by dragging one over the top of the other.

Comment Block

The comment block enables a free format block for the entry of descriptive text.

Comment Block Dialog